package cc.liyinghao.controller;

import cc.liyinghao.service.SearchService;
import cc.liyinghao.response.SearchUserByUserNameVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/search")
@RequiredArgsConstructor
@Api(tags = "搜索路由")
public class SearchController {

    final private SearchService searchService;

    @ApiOperation(value = "搜索用户")
    @GetMapping("/user")
    public List<SearchUserByUserNameVo> searchUserByUserName(String username) {
        return searchService.searchUserByUserName(username);
    }

    @ApiOperation(value = "搜索用户并判断是否为联系人")
    @GetMapping("/is_contact")
    public List<SearchUserByUserNameVo> searchContactByUserName(String username) {
        return searchService.searchUserByUserName(username);
    }

}
